//
//  NEDViewController.m
//  NEDBugConsole
//
//  Created by 林宁宁 on 12/14/2021.
//  Copyright (c) 2021 林宁宁. All rights reserved.
//

#import "NEDViewController.h"
#import "NEDConsole.h"
#import "NEDDetailViewController.h"
#import "NEDRouter+Map.h"
#import "TestApi.h"
#import <AFNetworking.h>

@interface NEDViewController ()

@end

@implementation NEDViewController

+(void)load{
    [NEDRouter ned_bindKeys:@[@"home", @(1)] vcClass:self.class];

    [NEDRouter sharedManager].urlComponentsHostAppOut = @"web";
    [NEDRouter sharedManager].urlComponentsHostAppIn = @"app";

    [NEDRouter ned_bindKey:@"WebActivity" vcClassName:@"NEDWebViewController"];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    self.title = @"home - 1";
    
    [NEDConsole addEnv:0 handle:^{
        NSLog(@"设置需要的开发状态的域名");
    } description:@"开发  dev.baidu.com"];
    
    [NEDConsole addEnv:1 handle:^{
        NSLog(@"设置需要的测试状态的域名");
    } description:@"测试  test.baidu.com"];
    
    [NEDConsole addEnv:2 handle:^{
        NSLog(@"设置需要的发布状态的域名");
    } description:@"发布  baidu.com"];
    
    [NEDConsole addRouterHandle:^(NSString * _Nonnull routerURl) {
        [NEDRouter ned_openSchemeURL:routerURl];
    }];
    
    [NEDConsole enableDebugMode];
    
    [self logTest];
    
    
    
    AFHTTPSessionManager *manger = [AFHTTPSessionManager manager];
    [manger GET:@"http://api.nnzhp.cn/api/user/stu_info" parameters:nil headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
    
    TestApi *api = [[TestApi alloc] init];
    [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        NSLog(@"---");
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        NSLog(@"xxx");
    }];
    
    [NSURLConnection sendAsynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]] queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        
    }];
    
    
    NSData* data = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.quwenlieqi.com/upload/allimg/140924/1606235532-14.jpg"]];
}

- (void)logTest{
    NSLog(@"测试log  ： %ud",arc4random()%1000);
    
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        [self logTest];
//
////        NSArray * list = @[];
////        NSLog(@"%@",list[1]);
//    });
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
